// --------------------------------------------------------------------------------------------------------------------
// <copyright file="DataSetErrorMsg.cs" company="SmartPlan">
//   SmartPlan 2011
// </copyright>
// <summary>
//   Summary description for ErrorMsg.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace DbDiff.Common.DataAccess
{
    using System;
    using System.Collections.Generic;
    using System.Data;
    using Helper;

    /// <summary>
    /// The error message table after compare
    /// </summary>
    [Serializable]
    public class ErrorMessageTables 
    {
        public ErrorMessageTables()
        {
            this.Tables = new List<DataTable>();

            foreach(string s in ( Enum.GetNames(typeof(DatabaseObjectTypes))) )
            {
                this.Tables.Add(new DataTable(s) );
            }

            int index = this.FindIndexByName(DatabaseObjectDictionary.ObjectTypes[DatabaseObjectTypes.Table]);

            this.Tables[index].Columns.AddRange( new DataColumn[]
            {
                new DataColumn("SchemaName", typeof(string)), 
                new DataColumn("TableName", typeof(string)), 
                new DataColumn("TableHasForeignKey", typeof(string)), 
                new DataColumn("TableHasIndex", typeof(string)), 
                new DataColumn("TableHasPrimaryKey", typeof(string)), 
                new DataColumn("TableFileGroup", typeof(string)), 
                new DataColumn("TableTextInRowLimit", typeof(string)), 
                new DataColumn("TableIsPinned", typeof(string)), 
                new DataColumn("TableFullTextBackgroundUpdateIndexOn", typeof(string)), 
                new DataColumn("TextFileGroup", typeof(string)), 
                new DataColumn("TableHasUniqueCnst", typeof(string)), 
                new DataColumn("TableHasCheckCnst", typeof(string))
            }
                );

            this.Tables[index].Columns["SchemaName"].Caption = "Schema name";
            this.Tables[index].Columns["TableName"].Caption = "Table name";
            this.Tables[index].Columns["TableHasForeignKey"].Caption = "false";
            this.Tables[index].Columns["TableHasIndex"].Caption = "false";
            this.Tables[index].Columns["TableHasPrimaryKey"].Caption = "false";
            this.Tables[index].Columns["TableFileGroup"].Caption = "File group";
            this.Tables[index].Columns["TableTextInRowLimit"].Caption = "Text row limit";
            this.Tables[index].Columns["TableIsPinned"].Caption = "Pinned";
            this.Tables[index].Columns["TableFullTextBackgroundUpdateIndexOn"].Caption = "Fulltext update";
            this.Tables[index].Columns["TextFileGroup"].Caption = "Text file group";
            this.Tables[index].Columns["TableHasUniqueCnst"].Caption = "false";
            this.Tables[index].Columns["TableHasCheckCnst"].Caption = "false";

            index = this.FindIndexByName(DatabaseObjectDictionary.ObjectTypes[DatabaseObjectTypes.Function]);
            this.Tables[index].Columns.AddRange( new DataColumn[]
            {
                new DataColumn("SchemaName", typeof(string)), 
                new DataColumn("Name", typeof(string)), 
                new DataColumn("IsQuotedIdentsOn", typeof(string)), 
                new DataColumn("IsAnsiNullsOn", typeof(string)), 
                new DataColumn("IsSchemaBound", typeof(string))
            }
                );

            this.Tables[index].Columns["SchemaName"].Caption = "Schema name";
            this.Tables[index].Columns["Name"].Caption = "Name ";
            this.Tables[index].Columns["IsQuotedIdentsOn"].Caption = "Quoted ident";
            this.Tables[index].Columns["IsAnsiNullsOn"].Caption = "Ansi nulls";
            this.Tables[index].Columns["IsSchemaBound"].Caption = "Schema bound";

            index = this.FindIndexByName(DatabaseObjectDictionary.ObjectTypes[DatabaseObjectTypes.ReplicationProcedure]);
            this.Tables[index].Columns.AddRange( new DataColumn[]
            {

            }
                );


            index = this.FindIndexByName(DatabaseObjectDictionary.ObjectTypes[DatabaseObjectTypes.Procedure]);
            this.Tables[index].Columns.AddRange( new DataColumn[]
            {
                new DataColumn("SchemaName", typeof(string)), 
                new DataColumn("Name", typeof(string)), 
                new DataColumn("IsStartup", typeof(string)), 
                new DataColumn("IsQuotedIdentsOn", typeof(string)), 
                new DataColumn("IsAnsiNullsOn", typeof(string))
            }
                );

            this.Tables[index].Columns["SchemaName"].Caption = "Schema name";
            this.Tables[index].Columns["Name"].Caption = "Proc name";
            this.Tables[index].Columns["IsStartup"].Caption = "Exec startup";
            this.Tables[index].Columns["IsQuotedIdentsOn"].Caption = "Quoted ident";
            this.Tables[index].Columns["IsAnsiNullsOn"].Caption = "Ansi nulls";

            index = this.FindIndexByName(DatabaseObjectDictionary.ObjectTypes[DatabaseObjectTypes.Trigger]);
            this.Tables[index].Columns.AddRange( new DataColumn[]
            {
                new DataColumn("SchemaName", typeof(string)), 
                new DataColumn("Name", typeof(string)), 
                new DataColumn("IsQuotedIdentsOn", typeof(string)), 
                new DataColumn("IsAnsiNullsOn", typeof(string)), 
                new DataColumn("IsFirstDeleteTrigger", typeof(string)), 
                new DataColumn("IsFirstInsertTrigger", typeof(string)), 
                new DataColumn("IsFirstUpdateTrigger", typeof(string)), 
                new DataColumn("IsLastDeleteTrigger", typeof(string)), 
                new DataColumn("IsLastInsertTrigger", typeof(string)), 
                new DataColumn("IsLastUpdateTrigger", typeof(string)), 
                new DataColumn("TriggerIsDisabled", typeof(string)), 
                new DataColumn("ExecIsDeleteTrigger", typeof(string)), 
                new DataColumn("ExecIsInsertTrigger", typeof(string)), 
                new DataColumn("ExecIsUpdateTrigger", typeof(string))
            }
                );

            this.Tables[index].Columns["SchemaName"].Caption = "Schema name";
            this.Tables[index].Columns["Name"].Caption = "Trigger name";
            this.Tables[index].Columns["IsQuotedIdentsOn"].Caption = "Quoted ident";
            this.Tables[index].Columns["IsAnsiNullsOn"].Caption = "Ansi nulls";
            this.Tables[index].Columns["IsFirstDeleteTrigger"].Caption = "First delete trigger";
            this.Tables[index].Columns["IsFirstInsertTrigger"].Caption = "First insert trigger";
            this.Tables[index].Columns["IsFirstUpdateTrigger"].Caption = "First update trigger";
            this.Tables[index].Columns["IsLastDeleteTrigger"].Caption = "Last delete trigger";
            this.Tables[index].Columns["IsLastInsertTrigger"].Caption = "Last insert trigger";
            this.Tables[index].Columns["IsLastUpdateTrigger"].Caption = "Last update trigger";
            this.Tables[index].Columns["TriggerIsDisabled"].Caption = "Trigger disabled";
            this.Tables[index].Columns["ExecIsDeleteTrigger"].Caption = "Delete trigger";
            this.Tables[index].Columns["ExecIsInsertTrigger"].Caption = "Insert trigger";
            this.Tables[index].Columns["ExecIsUpdateTrigger"].Caption = "Update trigger";

            index = this.FindIndexByName(DatabaseObjectDictionary.ObjectTypes[DatabaseObjectTypes.View]);
            this.Tables[index].Columns.AddRange( new DataColumn[]
            {
                new DataColumn("SchemaName", typeof(string)), 
                new DataColumn("Name", typeof(string)), 
                new DataColumn("IsQuotedIdentsOn", typeof(string)), 
                new DataColumn("IsAnsiNullsOn", typeof(string)), 
                new DataColumn("IsSchemaBound", typeof(string))
            }
                );

            this.Tables[index].Columns["SchemaName"].Caption = "Schema name";
            this.Tables[index].Columns["Name"].Caption = "View name";
            this.Tables[index].Columns["IsQuotedIdentsOn"].Caption = "Quoted ident";
            this.Tables[index].Columns["IsAnsiNullsOn"].Caption = "Ansi nulls";
            this.Tables[index].Columns["IsSchemaBound"].Caption = "Schema bound";

            index = this.FindIndexByName(DatabaseObjectDictionary.ObjectTypes[DatabaseObjectTypes.Details]);
            this.Tables[index].Columns.AddRange( new DataColumn[]
            {
                new DataColumn("SchemaName", typeof(string)), 
                new DataColumn("Name", typeof(string)), 
                new DataColumn("ObjectType", typeof(string)), 
                new DataColumn("Text", typeof(string))
            }
                );

            this.Tables[index].Columns["SchemaName"].Caption = "Schema name";
            this.Tables[index].Columns["Name"].Caption = "Object name";
            this.Tables[index].Columns["ObjectType"].Caption = string.Empty;
            this.Tables[index].Columns["Text"].Caption = string.Empty;

            index = this.FindIndexByName(DatabaseObjectDictionary.ObjectTypes[DatabaseObjectTypes.Fields]);
            this.Tables[index].Columns.AddRange(new DataColumn[]
            {
                new DataColumn("SchemaName", typeof(string)), 
                new DataColumn("TableName", typeof(string)), 
                new DataColumn("Name", typeof(string)), 
                new DataColumn("ColId", typeof(string)), 
                new DataColumn("DataTypeName", typeof(string)), 
                new DataColumn("BaseTypeName", typeof(string)), 
                new DataColumn("Length", typeof(string)), 
                new DataColumn("Precision", typeof(string)), 
                new DataColumn("Scale", typeof(string)), 
                new DataColumn("AllowsNull", typeof(string)), 
                new DataColumn("IsIdentity", typeof(string)), 
                new DataColumn("IdentSeed", typeof(string)), 
                new DataColumn("IdentIncr", typeof(string)), 
                new DataColumn("ConstrName", typeof(string)), 
                new DataColumn("ConstrNameIsGenerated", typeof(string)), 
                new DataColumn("DefConstrSchema", typeof(string)), 
                new DataColumn("DefConstrName", typeof(string)), 
                new DataColumn("IsComputed", typeof(string)), 
                new DataColumn("ComputedText", typeof(string)), 
                new DataColumn("IsIdNotForRepl", typeof(string)), 
                new DataColumn("IsFulltextIndexed", typeof(string)), 
                new DataColumn("UsesAnsiTrim", typeof(string)), 
                new DataColumn("RuleSchema", typeof(string)), 
                new DataColumn("RuleName", typeof(string)), 
                new DataColumn("Collation", typeof(string)), 
                new DataColumn("IsIndexable", typeof(string)), 
                new DataColumn("ColType", typeof(string)), 
                new DataColumn("IsRowGuidCol", typeof(string)), 
                new DataColumn("ConstrSchema", typeof(string)), 
                new DataColumn("RoleSchema", typeof(string)), 
                new DataColumn("RoleName", typeof(string))
            }
                );

            this.Tables[index].Columns["SchemaName"].Caption = "Schema name";
            this.Tables[index].Columns["TableName"].Caption = "Table name";
            this.Tables[index].Columns["Name"].Caption = "Column name";
            this.Tables[index].Columns["ColId"].Caption = "Col order";
            this.Tables[index].Columns["DataTypeName"].Caption = "Data type";
            this.Tables[index].Columns["BaseTypeName"].Caption = "Base type";
            this.Tables[index].Columns["Length"].Caption = "Column length";
            this.Tables[index].Columns["Precision"].Caption = "Precision ";
            this.Tables[index].Columns["Scale"].Caption = "Scale ";
            this.Tables[index].Columns["AllowsNull"].Caption = "Allows Null";
            this.Tables[index].Columns["IsIdentity"].Caption = "Is identity";
            this.Tables[index].Columns["IdentSeed"].Caption = "Ident seed";
            this.Tables[index].Columns["IdentIncr"].Caption = "Ident incr";
            this.Tables[index].Columns["ConstrName"].Caption = "Constraint name";
            this.Tables[index].Columns["ConstrNameIsGenerated"].Caption = "Generated Name";
            this.Tables[index].Columns["DefConstrSchema"].Caption = "Default constraint schema";
            this.Tables[index].Columns["DefConstrName"].Caption = "Default constraint name";
            this.Tables[index].Columns["IsComputed"].Caption = "Computed";
            this.Tables[index].Columns["ComputedText"].Caption = "Computed text";
            this.Tables[index].Columns["IsIdNotForRepl"].Caption = "Id not for replication";
            this.Tables[index].Columns["IsFulltextIndexed"].Caption = "Full text idexed";
            this.Tables[index].Columns["UsesAnsiTrim"].Caption = "Uses ansi trim when table created";
            this.Tables[index].Columns["RuleSchema"].Caption = "Rule schema";
            this.Tables[index].Columns["RuleName"].Caption = "Rule name";
            this.Tables[index].Columns["Collation"].Caption = "Collation ";
            this.Tables[index].Columns["IsIndexable"].Caption = "Is Indexable";
            this.Tables[index].Columns["ColType"].Caption = "Col type";
            this.Tables[index].Columns["IsRowGuidCol"].Caption = "Row GUID";
            this.Tables[index].Columns["ConstrSchema"].Caption = "Constraint schema";
            this.Tables[index].Columns["RoleSchema"].Caption = "Role schema";
            this.Tables[index].Columns["RoleName"].Caption = "Role name";

            index = this.FindIndexByName(DatabaseObjectDictionary.ObjectTypes[DatabaseObjectTypes.Check]);
            this.Tables[index].Columns.AddRange( new DataColumn[]
            {
                new DataColumn("SchemaName", typeof(string)), 
                new DataColumn("TableName", typeof(string)), 
                new DataColumn("Name", typeof(string)), 
                new DataColumn("NoName", typeof(string)), 
                new DataColumn("CnsIsDisabled", typeof(string)), 
                new DataColumn("CnsIsNotTrusted", typeof(string)), 
                new DataColumn("CnsNotForReplication", typeof(string)), 
                new DataColumn("Id", typeof(string)), 
                new DataColumn("GeneratedName", typeof(string)), 
                new DataColumn("UsesDatabaseCollation", typeof(string))
            }
                );

            this.Tables[index].Columns["SchemaName"].Caption = "Schema name";
            this.Tables[index].Columns["TableName"].Caption = "Table name";
            this.Tables[index].Columns["Name"].Caption = "Check constraint name";
            this.Tables[index].Columns["NoName"].Caption = "No name";
            this.Tables[index].Columns["CnsIsDisabled"].Caption = "Disabled constraint";
            this.Tables[index].Columns["CnsIsNotTrusted"].Caption = "Constraint was enabled without checking existing rows.";
            this.Tables[index].Columns["CnsNotForReplication"].Caption = "Not for replication";
            this.Tables[index].Columns["Id"].Caption = "false";
            this.Tables[index].Columns["GeneratedName"].Caption = "false";
            this.Tables[index].Columns["UsesDatabaseCollation"].Caption = "Uses database collation";

            index = this.FindIndexByName(DatabaseObjectDictionary.ObjectTypes[DatabaseObjectTypes.Index]);
            this.Tables[index].Columns.AddRange( new DataColumn[]
            {
                new DataColumn("SchemaName", typeof(string)), 
                new DataColumn("TableName", typeof(string)), 
                new DataColumn("Name", typeof(string)), 
                new DataColumn("IndexFillFactor", typeof(string)), 
                new DataColumn("IsClustered", typeof(string)), 
                new DataColumn("IsFullTextKey", typeof(string)), 
                new DataColumn("IsPadIndex", typeof(string)), 
                new DataColumn("IndexFileGroup", typeof(string)), 
                new DataColumn("IdxCnstIsDisabled", typeof(string)), 
                new DataColumn("IdxCnstIsNotTrusted", typeof(string)), 
                new DataColumn("IsUnique", typeof(string)), 
                new DataColumn("IsPrimaryKey", typeof(string)), 
                new DataColumn("NoName", typeof(string)), 
                new DataColumn("IsConstraint", typeof(string)), 
                new DataColumn("NoRecompute", typeof(string)), 
                new DataColumn("IgnoreDupKey", typeof(string)), 
                new DataColumn("IndId", typeof(string)), 
                new DataColumn("GeneratedName", typeof(string)), 
                new DataColumn("IsPageLockAllowed", typeof(string)), 
                new DataColumn("IsRowLockAllowed", typeof(string)),
                new DataColumn("IsDisabled", typeof(string)),
                new DataColumn("HasFilter", typeof(string)),
                new DataColumn("FilterDefinition", typeof(string)),
                new DataColumn("PartitionSchema", typeof(string)),
            }
                );

            this.Tables[index].Columns["SchemaName"].Caption = "Schema name";
            this.Tables[index].Columns["TableName"].Caption = "Table name";
            this.Tables[index].Columns["Name"].Caption = "Index name";
            this.Tables[index].Columns["IndexFillFactor"].Caption = "Index fill factor";
            this.Tables[index].Columns["IsClustered"].Caption = "Clustered";
            this.Tables[index].Columns["IsFullTextKey"].Caption = "Full text key";
            this.Tables[index].Columns["IsPadIndex"].Caption = "Pad index";
            this.Tables[index].Columns["IndexFileGroup"].Caption = "Filegroup";
            this.Tables[index].Columns["IdxCnstIsDisabled"].Caption = "Unique/Primary disabled";
            this.Tables[index].Columns["IdxCnstIsNotTrusted"].Caption = "Not trusted";
            this.Tables[index].Columns["IsUnique"].Caption = "Unique";
            this.Tables[index].Columns["IsPrimaryKey"].Caption = "Primary";
            this.Tables[index].Columns["NoName"].Caption = "No name";
            this.Tables[index].Columns["IsConstraint"].Caption = "Constraint";
            this.Tables[index].Columns["NoRecompute"].Caption = "No recompute";
            this.Tables[index].Columns["IgnoreDupKey"].Caption = "Ignore Duplicate Key";
            this.Tables[index].Columns["IndId"].Caption = "false";
            this.Tables[index].Columns["GeneratedName"].Caption = "false";
            this.Tables[index].Columns["IsPageLockAllowed"].Caption = "Page lock enabled";
            this.Tables[index].Columns["IsRowLockAllowed"].Caption = "Row lock enabled";
            this.Tables[index].Columns["IsDisabled"].Caption = "Index disable";
            this.Tables[index].Columns["HasFilter"].Caption = "Filter";
            this.Tables[index].Columns["FilterDefinition"].Caption = "Filter definition";
            this.Tables[index].Columns["PartitionSchema"].Caption = "Partition schema";

            index = this.FindIndexByName(DatabaseObjectDictionary.ObjectTypes[DatabaseObjectTypes.Foreign]);
            this.Tables[index].Columns.AddRange( new DataColumn[]
            {
                new DataColumn("SchemaName", typeof(string)), 
                new DataColumn("TableName", typeof(string)), 
                new DataColumn("Name", typeof(string)), 
                new DataColumn("RSchema", typeof(string)), 
                new DataColumn("RTableName", typeof(string)), 
                new DataColumn("FkeyCnstIsDisabled", typeof(string)), 
                new DataColumn("FkeyDeleteCascade", typeof(string)), 
                new DataColumn("FkeyUpdateCascade", typeof(string)), 
                new DataColumn("FkeyCnstIsColumn", typeof(string)), 
                new DataColumn("FkeyCnstIsNotTrusted", typeof(string)), 
                new DataColumn("FkeyCnstIsNotForReplication", typeof(string)), 
                new DataColumn("NoName", typeof(string)), 
                new DataColumn("GeneratedName", typeof(string))
            }
                );

            this.Tables[index].Columns["SchemaName"].Caption = "Schema name";
            this.Tables[index].Columns["TableName"].Caption = "Table name";
            this.Tables[index].Columns["Name"].Caption = "Foreign name";
            this.Tables[index].Columns["RSchema"].Caption = "Reference Schema";
            this.Tables[index].Columns["RTableName"].Caption = "Reference table";
            this.Tables[index].Columns["FkeyCnstIsDisabled"].Caption = "Foreing key disabled";
            this.Tables[index].Columns["FkeyDeleteCascade"].Caption = "Delete cascade";
            this.Tables[index].Columns["FkeyUpdateCascade"].Caption = "Update cascade";
            this.Tables[index].Columns["FkeyCnstIsColumn"].Caption = "Column constraint";
            this.Tables[index].Columns["FkeyCnstIsNotTrusted"].Caption = "Fkey was enabled without checking existing rows.";
            this.Tables[index].Columns["FkeyCnstIsNotForReplication"].Caption = "Not for replication";
            this.Tables[index].Columns["NoName"].Caption = "No name";
            this.Tables[index].Columns["GeneratedName"].Caption = "false";

            index = this.FindIndexByName(DatabaseObjectDictionary.ObjectTypes[DatabaseObjectTypes.Database]);
            this.Tables[index].Columns.AddRange( new DataColumn[]
            {
                new DataColumn("Server", typeof(string)), 
                new DataColumn("Name", typeof(string)), 
                new DataColumn("HasDbAccess", typeof(string)), 
                new DataColumn("IsAutoClose", typeof(string)), 
                new DataColumn("IsAutoCreateStatistics", typeof(string)), 
                new DataColumn("IsAutoShrink", typeof(string)), 
                new DataColumn("IsAutoUpdateStatistics", typeof(string)), 
                new DataColumn("IsAnsiNullDefault", typeof(string)), 
                new DataColumn("IsAnsiNullsEnabled", typeof(string)), 
                new DataColumn("IsAnsiPaddingEnabled", typeof(string)), 
                new DataColumn("IsAnsiWarningsEnabled", typeof(string)), 
                new DataColumn("IsArithmeticAbortEnabled", typeof(string)), 
                new DataColumn("IsNullConcat", typeof(string)), 
                new DataColumn("IsNumericRoundAbortEnabled", typeof(string)), 
                new DataColumn("IsQuotedIdentifiersEnabled", typeof(string)), 
                new DataColumn("IsRecursiveTriggersEnabled", typeof(string)), 
                new DataColumn("IsTornPageDetectionEnabled", typeof(string)), 
                new DataColumn("IsCloseCursorsOnCommitEnabled", typeof(string)), 
                new DataColumn("IsLocalCursorsDefault", typeof(string)), 
                new DataColumn("Status", typeof(string)), 
                new DataColumn("Updateability", typeof(string)), 
                new DataColumn("Collation", typeof(string)), 
                new DataColumn("RecoveryOption", typeof(string)), 
                new DataColumn("DatabaseVersion", typeof(string)), 
                new DataColumn("DataBaseLevel", typeof(string)), 
                new DataColumn("IsFulltextEnabled", typeof(string)), 
                new DataColumn("IsInStandBy", typeof(string)), 
                new DataColumn("IsMergePublished", typeof(string)), 
                new DataColumn("IsSubscribed", typeof(string)), 
                new DataColumn("UserAccess", typeof(string))
            }
                );

            this.Tables[index].Columns["Server"].Caption = "Server name";
            this.Tables[index].Columns["Name"].Caption = "Database name";
            this.Tables[index].Columns["HasDbAccess"].Caption = "Has Db Access";
            this.Tables[index].Columns["IsAutoClose"].Caption = "Database auto close";
            this.Tables[index].Columns["IsAutoCreateStatistics"].Caption = "Auto create statistic";
            this.Tables[index].Columns["IsAutoShrink"].Caption = "Auto shrink";
            this.Tables[index].Columns["IsAutoUpdateStatistics"].Caption = "Auto update statistics";
            this.Tables[index].Columns["IsAnsiNullDefault"].Caption = "Database follows SQL-92 rules for allowing null values.";
            this.Tables[index].Columns["IsAnsiNullsEnabled"].Caption = "Ansi nulls enabled";
            this.Tables[index].Columns["IsAnsiPaddingEnabled"].Caption = "Ansi padding enabled";
            this.Tables[index].Columns["IsAnsiWarningsEnabled"].Caption = "Ansi warning enabled";
            this.Tables[index].Columns["IsArithmeticAbortEnabled"].Caption = "Arithmetic abort enabled";
            this.Tables[index].Columns["IsNullConcat"].Caption = "Null concat";
            this.Tables[index].Columns["IsNumericRoundAbortEnabled"].Caption = "Numeric round abort";
            this.Tables[index].Columns["IsQuotedIdentifiersEnabled"].Caption = "Quoted identifiers";
            this.Tables[index].Columns["IsRecursiveTriggersEnabled"].Caption = "Recursive trigger";
            this.Tables[index].Columns["IsTornPageDetectionEnabled"].Caption = "Torn page detection";
            this.Tables[index].Columns["IsCloseCursorsOnCommitEnabled"].Caption = "Closer cursor on commit";
            this.Tables[index].Columns["IsLocalCursorsDefault"].Caption = "Cursor declarations default to LOCAL";
            this.Tables[index].Columns["Status"].Caption = "Database status";
            this.Tables[index].Columns["Updateability"].Caption = "Indicates whether data can be modified.";
            this.Tables[index].Columns["Collation"].Caption = "Collation ";
            this.Tables[index].Columns["RecoveryOption"].Caption = "Recovery mode";
            this.Tables[index].Columns["DatabaseVersion"].Caption = "Internal version";
            this.Tables[index].Columns["DataBaseLevel"].Caption = "Compatibility level (60,65,70,80)";
            this.Tables[index].Columns["IsFulltextEnabled"].Caption = "Full text enabled";
            this.Tables[index].Columns["IsInStandBy"].Caption = "Standby";
            this.Tables[index].Columns["IsMergePublished"].Caption = "Merge published";
            this.Tables[index].Columns["IsSubscribed"].Caption = "Subscribed";
            this.Tables[index].Columns["UserAccess"].Caption = "Indicates which users can access the database.";

            index = this.FindIndexByName(DatabaseObjectDictionary.ObjectTypes[DatabaseObjectTypes.Server]);
            this.Tables[index].Columns.AddRange( new DataColumn[]
            {
                new DataColumn("Server", typeof(string)), 
                new DataColumn("Name", typeof(string)), 
                new DataColumn("Collation", typeof(string)), 
                new DataColumn("Edition", typeof(string)), 
                new DataColumn("ProcuctVersion", typeof(string)), 
                new DataColumn("ProductLevel", typeof(string)), 
                new DataColumn("IsFullTextInstalled", typeof(string)), 
                new DataColumn("IsIntegratedSecurityOnly", typeof(string)), 
                new DataColumn("IsSingleUser", typeof(string)), 
                new DataColumn("IsSyncWithBackup", typeof(string))
            }
                );

            this.Tables[index].Columns["Server"].Caption = "Server name";
            this.Tables[index].Columns["Name"].Caption = "Server name";
            this.Tables[index].Columns["Collation"].Caption = "Collation ";
            this.Tables[index].Columns["Edition"].Caption = "Edition ";
            this.Tables[index].Columns["ProcuctVersion"].Caption = "Product version";
            this.Tables[index].Columns["ProductLevel"].Caption = "Product level";
            this.Tables[index].Columns["IsFullTextInstalled"].Caption = "Fulltext installed";
            this.Tables[index].Columns["IsIntegratedSecurityOnly"].Caption = "Windows authentication only";
            this.Tables[index].Columns["IsSingleUser"].Caption = "Single user mod";
            this.Tables[index].Columns["IsSyncWithBackup"].Caption = "Any database replicated";

            index = this.FindIndexByName(DatabaseObjectDictionary.ObjectTypes[DatabaseObjectTypes.Rule]);
            this.Tables[index].Columns.AddRange( new DataColumn[]
            {
                new DataColumn("SchemaName", typeof(string)), 
                new DataColumn("Name", typeof(string))
            }
                );

            this.Tables[index].Columns["SchemaName"].Caption = "Schema name";
            this.Tables[index].Columns["Name"].Caption = "Rule name";

            index = this.FindIndexByName(DatabaseObjectDictionary.ObjectTypes[DatabaseObjectTypes.Default]);
            this.Tables[index].Columns.AddRange( new DataColumn[]
            {
                new DataColumn("SchemaName", typeof(string)), 
                new DataColumn("Name", typeof(string))
            }
                );

            this.Tables[index].Columns["SchemaName"].Caption = "Schema name";
            this.Tables[index].Columns["Name"].Caption = "Default name";

            index = this.FindIndexByName(DatabaseObjectDictionary.ObjectTypes[DatabaseObjectTypes.DefaultCnst]);
            this.Tables[index].Columns.AddRange( new DataColumn[]
            {
                new DataColumn("SchemaName", typeof(string)), 
                new DataColumn("Name", typeof(string))
            }
                );

            this.Tables[index].Columns["SchemaName"].Caption = "Schema name";
            this.Tables[index].Columns["Name"].Caption = "Def.const. name";

            index = this.FindIndexByName(DatabaseObjectDictionary.ObjectTypes[DatabaseObjectTypes.UDT]);
            this.Tables[index].Columns.AddRange( new DataColumn[]
            {
                new DataColumn("SchemaName", typeof(string)), 
                new DataColumn("Name", typeof(string)), 
                new DataColumn("AllowNulls", typeof(string)), 
                new DataColumn("Length", typeof(string)), 
                new DataColumn("Precision", typeof(string)), 
                new DataColumn("Scale", typeof(string)), 
                new DataColumn("BaseType", typeof(string)), 
                new DataColumn("DefaultSchema", typeof(string)), 
                new DataColumn("DefaultName", typeof(string)), 
                new DataColumn("RuleSchema", typeof(string)), 
                new DataColumn("RuleName", typeof(string))
            }
                );

            this.Tables[index].Columns["SchemaName"].Caption = "Schema name";
            this.Tables[index].Columns["Name"].Caption = "UDT name";
            this.Tables[index].Columns["AllowNulls"].Caption = "allow null";
            this.Tables[index].Columns["Length"].Caption = "Column length";
            this.Tables[index].Columns["Precision"].Caption = "Precision ";
            this.Tables[index].Columns["Scale"].Caption = "Scale ";
            this.Tables[index].Columns["BaseType"].Caption = "base type";
            this.Tables[index].Columns["DefaultSchema"].Caption = "Default schema";
            this.Tables[index].Columns["DefaultName"].Caption = "Default name";
            this.Tables[index].Columns["RuleSchema"].Caption = "Rule schema";
            this.Tables[index].Columns["RuleName"].Caption = "Rule name";

            index = this.FindIndexByName(DatabaseObjectDictionary.ObjectTypes[DatabaseObjectTypes.User]);
            this.Tables[index].Columns.AddRange( 
                new DataColumn[]
            {
                new DataColumn("Name",  typeof(string)),
                new DataColumn("LoginName", typeof(string)),
                new DataColumn("DbName",  typeof(string)),
                new DataColumn("IsSqlUser", typeof(string))
            }
                );

            this.Tables[index].Columns["Name"].Caption = "User name";
            this.Tables[index].Columns["LoginName"].Caption = "Login name";
            this.Tables[index].Columns["DbName"].Caption = "db name";
            this.Tables[index].Columns["IsSqlUser"].Caption = "Sql user";

            index = this.FindIndexByName(DatabaseObjectDictionary.ObjectTypes[DatabaseObjectTypes.IndexKey]);
            this.Tables[index].Columns.AddRange( new DataColumn[]
            {
                new DataColumn("SchemaName", typeof(string)), 
                new DataColumn("TableName", typeof(string)), 
                new DataColumn("Name", typeof(string)), 
                new DataColumn("ColumnName", typeof(string)), 
                new DataColumn("KeyNo", typeof(string)), 
                new DataColumn("IsDescending", typeof(string)), 
                new DataColumn("IndId", typeof(string)), 
                new DataColumn("IsIncluded", typeof(string))
            }
                );

            this.Tables[index].Columns["SchemaName"].Caption = "Schema name";
            this.Tables[index].Columns["TableName"].Caption = "Table name";
            this.Tables[index].Columns["Name"].Caption = "Index name";
            this.Tables[index].Columns["ColumnName"].Caption = "Column name";
            this.Tables[index].Columns["KeyNo"].Caption = "KeyNo ";
            this.Tables[index].Columns["IsDescending"].Caption = "Descending";
            this.Tables[index].Columns["IsIncluded"].Caption = "Included";
            this.Tables[index].Columns["IndId"].Caption = "false";

            index = this.FindIndexByName(DatabaseObjectDictionary.ObjectTypes[DatabaseObjectTypes.ForeignKey]);
            this.Tables[index].Columns.AddRange( new DataColumn[]
            {
                new DataColumn("SchemaName", typeof(string)), 
                new DataColumn("TableName", typeof(string)), 
                new DataColumn("Name", typeof(string)), 
                new DataColumn("Fkey", typeof(string)), 
                new DataColumn("Rkey", typeof(string)), 
                new DataColumn("KeyNo", typeof(string))
            }
                );

            this.Tables[index].Columns["SchemaName"].Caption = "Schema name";
            this.Tables[index].Columns["TableName"].Caption = "Table name";
            this.Tables[index].Columns["Name"].Caption = "Foreign name";
            this.Tables[index].Columns["Fkey"].Caption = "F.key ";
            this.Tables[index].Columns["Rkey"].Caption = "R.key ";
            this.Tables[index].Columns["KeyNo"].Caption = "KeyNo ";

            index = this.FindIndexByName(DatabaseObjectDictionary.ObjectTypes[DatabaseObjectTypes.Diff]);
            this.Tables[index].Columns.AddRange( new DataColumn[]
            {
                new DataColumn("SchemaName", typeof(string)), 
                new DataColumn("Name", typeof(string)), 
                new DataColumn("ObjectType", typeof(string)), 
                new DataColumn("DifferentImageType", typeof(string)), 
                new DataColumn("isCheckedLeft", typeof(string)), 
                new DataColumn("isCheckedRight", typeof(string)), 
                new DataColumn("Msg", typeof(string)), 
                new DataColumn("isDifferent", typeof(string)), 
                new DataColumn("SelectForCompare", typeof(string)), 
                new DataColumn("ID", typeof(string))
            }
                );

            this.Tables[index].Columns["SchemaName"].Caption = "Schema name";
            this.Tables[index].Columns["Name"].Caption = "Object name";
            this.Tables[index].Columns["ObjectType"].Caption = "false";
            this.Tables[index].Columns["DifferentImageType"].Caption = "false";
            this.Tables[index].Columns["isCheckedLeft"].Caption = "Exists left";
            this.Tables[index].Columns["isCheckedRight"].Caption = "Exists right";
            this.Tables[index].Columns["Msg"].Caption = "false";
            this.Tables[index].Columns["isDifferent"].Caption = "Different";
            this.Tables[index].Columns["SelectForCompare"].Caption = "Selected";
            this.Tables[index].Columns["ID"].Caption = "false";

            index = this.FindIndexByName(DatabaseObjectDictionary.ObjectTypes[DatabaseObjectTypes.DiffDetails]);
            this.Tables[index].Columns.AddRange( new DataColumn[]
            {
                new DataColumn("SchemaName", typeof(string)), 
                new DataColumn("Name", typeof(string)), 
                new DataColumn("MsgDetails", typeof(string)), 
                new DataColumn("ID", typeof(string)), 
                new DataColumn("FieldName", typeof(string)), 
                new DataColumn("DetailsErrorType", typeof(string)), 
                new DataColumn("Value1", typeof(string)), 
                new DataColumn("Value2", typeof(string)), 
                new DataColumn("ObjectType", typeof(string)), 
                new DataColumn("IndexName", typeof(string))
            }
                );
            
            this.Tables[index].Columns["SchemaName"].Caption = "Schema name";
            this.Tables[index].Columns["Name"].Caption = "Object name";
            this.Tables[index].Columns["MsgDetails"].Caption = "Error message";
            this.Tables[index].Columns["ID"].Caption = "false";
            this.Tables[index].Columns["FieldName"].Caption = "Name";
            this.Tables[index].Columns["DetailsErrorType"].Caption = "Details error type";
            this.Tables[index].Columns["Value1"].Caption = "Value Db1";
            this.Tables[index].Columns["Value2"].Caption = "Value Db2";
            this.Tables[index].Columns["ObjectType"].Caption = "false";
            this.Tables[index].Columns["IndexName"].Caption = "Index name";

        }

        /// <summary>
        /// Gets or sets Tables.
        /// </summary>
        public List<DataTable> Tables { get; private set; }

        public int FindIndexByName(string name)
        {
            return this.Tables.FindIndex(z => z.TableName == name);
        }

        internal void WriteXml(System.IO.StringWriter sw, XmlWriteMode xmlWriteMode)
        {
            //throw new NotImplementedException();
        }

        internal void ReadXml(System.IO.StringReader sr, XmlReadMode xmlReadMode)
        {
            //throw new NotImplementedException();
        }
    }
}
